/* 获取元素 */
const nav = document.querySelector(".nav");
/* 滚轮事件 */
window.addEventListener("scroll", fixNav);

function fixNav() {
  if(window.scrollY > nav.offsetHeight + 150) {
      nav.classList.add('active')
  } else {
      nav.classList.remove('active')
  }
}